﻿<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="Shortcut Icon" href="../images/aecc.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="../StaticFiles/element-ui/element-ui.css">
  <link rel="stylesheet" href="../StaticFiles/nprogress/nprogress.min.css">
  <link rel="stylesheet" href="../styles/vue-page-common.css">
  <link rel="stylesheet" href="../styles/table-transparent.css">
  <script src="../Scripts/vue.min.js"></script>
  <script src="../StaticFiles/element-ui/element-ui.js"></script>
  <script src="../Scripts/axios.min.js"></script>
  <script src="../StaticFiles/nprogress/nprogress.min.js"></script>
  <script src="../Scripts/crypto-js.js"></script>
  <script src="../Scripts/secret.js"></script>
  <script src="../Scripts/dayjs.min.js"></script>
  <script src="../Scripts/axios.config.js"></script>
  <script src="../Scripts/datav.min.vue.js"></script>
  <script src="../Scripts/lodash.min.js"></script>
  <title>工区看板v3.0</title>
  <style>
    html {
      background-image: url(../images/bg.jpg);
      color: #fff;
    }

    .header-title {
      font-size: 24px !important;
    }

    .el-form-item__label {
      color: #fff;
    }
  </style>
</head>

<body>
  <div id="app" v-cloak>
    <div style="padding:0 5px;">
      <el-row>
        <el-col :span="6"><img src="../images/aeec_logo.png" height="60" alt="黎阳LOGO" /></el-col>
        <el-col :span="12" class="header-title">{{queryInfo.workcentername}}看板v3.0</el-col>
        <el-col :span="6" class="currentTime">{{currentTime}}</el-col>
      </el-row>

      <!-- 查询条件区 -->
      <el-form :inline="true" :model="queryInfo" ref="queryInfoRef" :label-position="'left'" :rules="rules">
        <el-form-item label="筛选时间:" prop="selectdate">
          <el-date-picker v-model="queryInfo.selectdate" type="daterange" range-separator="至" value-format="yyyy-MM-dd"
            start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>

        <el-form-item label="周计划时间:" prop="weekplanfinishdate">
          <el-date-picker v-model="queryInfo.weekplanfinishdate" type="daterange" range-separator="至"
            value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="weekShortCuts">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="主制工区:">
          <el-select v-model="queryInfo.workcenterid" placeholder="请选择" filterable :disabled="disabled"
            @change="workcenterSelectChange">
            <el-option v-for="item in workcenterList" :key="item.workcenterid" :label="item.workcentername"
              :value="item.workcenterid">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="订单类型:">
          <el-select v-model="queryInfo.ordertype" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'临时'" :label="'临时'" :value="'临时'"></el-option>
            <el-option :key="'品种'" :label="'品种'" :value="'品种'"></el-option>
            <el-option :key="'预品种'" :label="'预品种'" :value="'预品种'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="计划类型:">
          <el-select v-model="queryInfo.plantype" placeholder="请选择" clearable filterable style="width: 90px;">
            <el-option :key="'初制'" :label="'初制'" :value="'初制'"></el-option>
            <el-option :key="'复制'" :label="'复制'" :value="'复制'"></el-option>
            <el-option :key="'修理'" :label="'修理'" :value="'修理'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否超期:">
          <el-select v-model="queryInfo.isdelay" placeholder="请选择" clearable filterable style="width: 90px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否跳序:">
          <el-select v-model="queryInfo.isskip" placeholder="请选择" clearable filterable style="width: 90px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="状态:">
          <el-select v-model="queryInfo.status" placeholder="请选择" clearable filterable style="width: 110px;">
            <el-option :key="'完工入库'" :label="'完工入库'" :value="'完工入库'"></el-option>
            <el-option :key="'待检验'" :label="'待检验'" :value="'待检验'"></el-option>
            <el-option :key="'待报工'" :label="'待报工'" :value="'待报工'"></el-option>
            <el-option :key="'待派工'" :label="'待派工'" :value="'待派工'"></el-option>
            <el-option :key="'已外委'" :label="'已外委'" :value="'已外委'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="零件号:" prop='productname'>
          <el-autocomplete v-model.trim="queryInfo.productname" placeholder="请输入零件号" :trigger-on-focus="false"
            style="width:190px;" :fetch-suggestions="searchProductAsync" :value-key="'productname'" :debounce="500">
          </el-autocomplete>
        </el-form-item>

        <el-form-item label="批次号:" prop='containername'>
          <el-autocomplete v-model.trim="queryInfo.containername" placeholder="请输入批次号" :trigger-on-focus="false"
            style="width:230px;" :fetch-suggestions="searchTopContainernameAsync" :value-key="'containername'"
            :debounce="500">
          </el-autocomplete>
        </el-form-item>

        <el-form-item label="重要程度:">
          <el-input v-model.trim="queryInfo.priority" placeholder="请输入" clearable style="width: 120px;"></el-input>
        </el-form-item>

        <el-form-item label="风险等级:">
          <el-input v-model.trim="queryInfo.risklevel" placeholder="请输入" clearable style="width: 120px;"></el-input>
        </el-form-item>

        <el-form-item label="工时完成率:">
          <el-slider v-model="queryInfo.worktimerate" range :max="100" :step="5" style="width: 80px;">
          </el-slider>
        </el-form-item>

        <el-form-item>
          <el-input v-model="worktimeratelable" style="width: 100px;font-size: 12px;" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="searchData">查询</el-button>
          <el-button type="primary" icon="el-icon-download" size="small" @click="exportDetail">导出</el-button>
          <el-link icon="el-icon-link" type="primary" @click="open('GZUnAllSetReport.html','缺件统计报表')">缺件统计报表</el-link>
          <el-link icon="el-icon-link" type="danger" @click="open('GZSkipStepReport.html','批次未完工报表')">批次未完工报表</el-link>
        </el-form-item>
      </el-form>

      <!-- 柱状图区域 -->
      <el-row>
        <el-col :span="7" style="position:relative;">
          <div class="tooltip">
            统计说明
            <el-popover placement="top-start" title="月生产情况计算规则:" width="400" trigger="hover">
              <i class="el-icon-info" slot="reference"></i>
              <p>查询【结束时间】在所选【筛选时间】范围内数据。</p>
            </el-popover>
          </div>
          <dv-border-box-11 title="月生产情况" ref="thisMonthChart">
            <div style="height: 260px;padding-top: 40px;" id="thisMonthChart"></div>
          </dv-border-box-11>
        </el-col>
        <el-col :span="7" style="position:relative;">
          <div class="tooltip">
            统计说明
            <el-popover placement="top-start" title="本周生产情况计算规则:" width="400" trigger="hover">
              <i class="el-icon-info" slot="reference"></i>
              <p>查询【周计划完成时间】在所选【周计划时间】范围内数据。</p>
            </el-popover>
          </div>
          <dv-border-box-11 title="本周生产情况" ref="thisWeekChart">
            <div style="height: 260px;padding-top: 40px;" id="thisWeekChart"></div>
          </dv-border-box-11>
        </el-col>
        <el-col :span="10" style="position:relative;">
          <div class="tooltip">
            统计说明
            <el-popover placement="top-start" title="工序的时间排布计算规则:" width="400" trigger="hover">
              <i class="el-icon-info" slot="reference"></i>
              <p>统计 <span class="tooltip-lable">停滞时间</span>在各时间区间的批次数，其中<span class="tooltip-lable">停滞时间</span> = 当前时间 -
                批次最后一次操作时间。数据过滤规则如下：</p>
              <p>1. 不查询<span class="tooltip-lable">已入库</span>批次。</p>
              <p>2. 不查询<span class="tooltip-lable">已关闭</span>批次。</p>
              <p>3. 不查询<span class="tooltip-lable">订单已关闭</span>批次。</p>
            </el-popover>
          </div>
          <dv-border-box-11 title="工序的时间排布" ref="containerPauseChart">
            <div style="height: 260px;padding-top: 40px;" id="containerPauseChart"></div>
          </dv-border-box-11>
        </el-col>
      </el-row>

      <!-- 工人未完成工时 -->
      <dv-border-box-11 title="工人未完成工时" ref="unFinishWorktimeChart" style="position:relative;">
        <div class="tooltip">
          统计说明
          <el-popover placement="top-start" title="工人未完成工时 计算规则:" width="400" trigger="hover">
            <i class="el-icon-info" slot="reference"></i>
            <p>1. 在所选时间范围内，<span class="tooltip-lable">派工</span>给本工区各工人的待完成工时。</p>
            <p>2. 在所选时间范围内，其他工区通过<span class="tooltip-lable">工区协作</span>给本工区工人的待完成工时。</p>
          </el-popover>
        </div>
        <div style="height: 260px;padding-top: 40px;" id="unFinishWorktimeChart"></div>
      </dv-border-box-11>

      <!-- 页面主表格 -->
      <dv-border-box-11 title="本月计划明细" ref="datagrid">
        <div id="datagrid" style="padding: 30px;padding-top:60px;padding-bottom:10px;">
          <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
            element-loading-background="rgba(0,0,0,0.8)" :data="dataList" stripe border>
            <el-table-column type="index" width="50"></el-table-column>
            <el-table-column label="操作" width="80">
              <template slot-scope="scope">
                <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
              </template>
            </el-table-column>
            <el-table-column label="零件号" prop="productname" width="160" show-overflow-tooltip></el-table-column>
            <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                  {{scope.row.isinstore}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
              style="font-size: 10px;"></el-table-column>
            <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
                <el-tag effect="dark" v-else type="info">待派工</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
            <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
            <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                  {{scope.row.delaystatus}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
            <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
                </el-progress>
              </template>
            </el-table-column>
            <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>
                  <el-link type="danger"
                    v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                    @click="getNotFinishedChildContainer(scope.row)">
                    {{scope.row.finishinfo}}
                  </el-link>
                  <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                  {{scope.row.isallset}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>
                  <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                    {{scope.row.lackqty}} 件</el-link>
                  <span v-else style="color:#67c23a">0</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
                <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                  {{scope.row.isskip}}</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
          </el-table>
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="queryInfo.currentPage" :page-sizes="[queryInfo.pageSize,20,50,100]"
            :page-size="queryInfo.pageSize" layout="prev,pager,next,jumper,sizes,total" :total="total">
          </el-pagination>
          <el-backtop></el-backtop>
        </div>
      </dv-border-box-11>

      <!-- 工区本月柱状图--明细对话框 -->
      <el-dialog :title="thisMonthChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="thisMonthChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="thisMonthChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                {{scope.row.delaystatus}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
          <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
              </el-progress>
            </template>
          </el-table-column>
          <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link type="danger" v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                  @click="getNotFinishedChildContainer(scope.row)">
                  {{scope.row.finishinfo}}
                </el-link>
                <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                {{scope.row.isallset}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                  {{scope.row.lackqty}} 件</el-link>
                <span v-else style="color:#67c23a">0</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
              <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                {{scope.row.isskip}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleThisMonthChartDetailCurrentChange"
          :current-page="thisMonthChartDetail.queryInfo.currentPage"
          :page-sizes="[thisMonthChartDetail.queryInfo.pageSize]" :page-size="thisMonthChartDetail.queryInfo.pageSize"
          layout="prev,pager,next,jumper,sizes,total" :total="thisMonthChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 工区本周柱状图--明细对话框 -->
      <el-dialog :title="thisWeekChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="thisWeekChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="thisWeekChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                {{scope.row.delaystatus}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
          <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
              </el-progress>
            </template>
          </el-table-column>
          <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link type="danger" v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                  @click="getNotFinishedChildContainer(scope.row)">
                  {{scope.row.finishinfo}}
                </el-link>
                <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                {{scope.row.isallset}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                  {{scope.row.lackqty}} 件</el-link>
                <span v-else style="color:#67c23a">0</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
              <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                {{scope.row.isskip}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleThisWeekChartDetailCurrentChange"
          :current-page="thisWeekChartDetail.queryInfo.currentPage"
          :page-sizes="[thisWeekChartDetail.queryInfo.pageSize]" :page-size="thisWeekChartDetail.queryInfo.pageSize"
          layout="prev,pager,next,jumper,sizes,total" :total="thisWeekChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 工序的时间排布对话框 -->
      <el-dialog :title="containerPauseChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="containerPauseChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="containerPauseChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="分厂" prop="factoryname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="主制工区" prop="fromworkcentername" width="140" show-overflow-tooltip></el-table-column>
          <el-table-column label="机型" prop="familylistnames" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件图号" prop="productname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="流水卡号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="当前工序" prop="workflowstepname" width="160" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划员" prop="fullname" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="开卡时间" prop="originalstartdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="当前工序开始时间" prop="lastactivitydate" width="140" :formatter="splitDate">
          </el-table-column>
          <el-table-column label="停滞时间" prop="remaindays" width="100">
            <template slot-scope="scope">
              <div v-if="scope.row.remaindays > 0" style="color:red;">
                <el-popover placement="top-start" title="" width="200" trigger="hover" content="\n ">
                  <i class="el-icon-info" slot="reference"></i>
                  <span>停滞时间 = 系统当前时间 - 当前工序开始时间</span>
                </el-popover>
                {{scope.row.remaindays}} 天
              </div>
              <div v-else>0</div>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @current-change="handleContainerPauseChartDetailCurrentChange"
          :current-page="containerPauseChartDetail.queryInfo.currentPage"
          :page-size="containerPauseChartDetail.queryInfo.pageSize"
          :page-sizes="[containerPauseChartDetail.queryInfo.pageSize]" layout="prev,pager,next,jumper,sizes,total"
          :total="containerPauseChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 工人未完成工时 对话框 -->
      <el-dialog :title="unFinishWorktimeChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="unFinishWorktimeChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="unFinishWorktimeChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="流水卡号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="主制工区" prop="fromworkcentername" width="140" show-overflow-tooltip>
            <template slot-scope="scope">
              <span v-if="scope.row.fromworkcentername !== scope.row.workcentername" style="color:red">
                {{scope.row.fromworkcentername}}
              </span>
              <span v-else>
                {{scope.row.fromworkcentername}}
              </span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="派工工区" prop="workcentername" width="140" show-overflow-tooltip></el-table-column> -->
          <el-table-column label="是否工区协作" prop="iscoop" width="70" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" type="danger" v-if="scope.row.iscoop === 1">是</el-tag>
              <el-tag effect="dark" v-else>否</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="160" show-overflow-tooltip></el-table-column>
          <el-table-column label="单位工时" prop="durationperunit" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工人" prop="dispatchemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工时间" prop="dispatchdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="报工人" prop="reportemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="报工时间" prop="reportdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="派工给" prop="dispatchto" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="100" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleUnFinishWorktimeChartDetailCurrentChange"
          :current-page="unFinishWorktimeChartDetail.queryInfo.currentPage"
          :page-size="unFinishWorktimeChartDetail.queryInfo.pageSize"
          :page-sizes="[unFinishWorktimeChartDetail.queryInfo.pageSize]" layout="prev,pager,next,jumper,sizes,total"
          :total="unFinishWorktimeChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 子零件批次 -->
      <el-dialog :title="childContainerDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="childContainerDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="childContainerDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainerSpec(scope.row)'>查看各工序</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="160" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="56" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate">/el-table-column>
            <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                  {{scope.row.delaystatus}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
            <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
                </el-progress>
              </template>
            </el-table-column>
            <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                  {{scope.row.isallset}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
                <el-tag effect="dark" v-else type="danger" style="cursor:pointer;"
                  @click="getChildContainerSkipInfo(scope.row)">
                  {{scope.row.isskip}}</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-dialog>

      <!-- 子零件批次工序 -->
      <el-dialog :title="childContainerSpecDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="childContainerSpecDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="childContainerSpecDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="批次号" prop="containername" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次数量" prop="qty" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="单位工时" prop="durationperunit" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工人" prop="dispatchemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工时间" prop="dispatchdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="报工人" prop="reportemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="报工时间" prop="reportdate" width="160" :formatter="replaceDate"></el-table-column>
          <el-table-column label="检验人" prop="checkemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="检验时间" prop="checkdate" width="160" :formatter="replaceDate"></el-table-column>
          <el-table-column label="检验类型" prop="checktype" width="90" show-overflow-tooltip>
            <template slot-scope="scope" v-if="scope.row.checktype">
              <span v-if="scope.row.checktype === 1">首件检验</span>
              <span v-else>其他检验</span>
            </template>
          </el-table-column>
          <el-table-column label="状态" prop="status" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effec="dark" v-if="scope.row.status === '已完工'" type="success">已完工</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effec="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="是否外委" prop="isww" width="100" show-overflow-tooltip>
            <template slot-scope="scope" v-if="scope.row.isww">
              <el-tag effect="dark" v-if="scope.row.isww === '是'" type="danger">是</el-tag>
              <el-tag effect="dark" v-else>否</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 缺件明细 -->
      <el-dialog :title="missingPartDetail.title" :width="'50%'" :center="'center'"
        :visible.sync="missingPartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="missingPartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="是否缺件" prop="isallset" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" type="danger">是</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 未完成子零件信息 -->
      <el-dialog :title="notFinishedChildContainerDetail.title" :width="'50%'" :center="'center'"
        :visible.sync="notFinishedChildContainerDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="notFinishedChildContainerDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="是否完成" prop="isallset" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" type="danger">否</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 跳序信息 -->
      <el-dialog :title="skipStepDetail.title" :width="'50%'" :top="'10px'" :center="'center'"
        :visible.sync="skipStepDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="skipStepDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序名称" prop="workflowstepname" width="120" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-dialog>
    </div>
  </div>
  <script src="../Scripts/echarts/echarts-5.4.0.min.js"></script>
  <script type="module">
    import { barOption, colorList } from '../Scripts/hooks/chartConfig.js'
    import { exportExcelData, getParams, fetchSuggestion } from '../Scripts/hooks/useCommonMethod.js'
    import { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth } from '../Scripts/hooks/useDateShortCut.js'
    import { getUserInfo, getFactoryInfo, getWorkcenterList } from '../Scripts/hooks/fetchAPI.js';
    import { splitDate, replaceDate } from '../Scripts/hooks/format.js'
    const app = new Vue({
      el: '#app',
      data: {
        splitDate, replaceDate,
        currentTime: '',
        total: 0,
        loading: false,
        loadingText: '数据加载中...',
        queryInfo: {
          factoryid: '',
          factoryname: '',
          selectdate: '',//筛选时间
          weekplanfinishdate: '',
          thisweek: '',//本周时间
          workcenterid: '',//主制工区
          workcentername: '',
          ordertype: '',//订单类型
          plantype: '',//计划类型
          isdelay: '',//是否超期
          isskip: '',//是否跳序
          status: '',//完工状态
          productname: '',//零件号
          containername: '',//批次号
          priority: '',//重要程度
          risklevel: '',//风险等级
          worktimerate: [0, 100],
          currentPage: 1,//当前页
          pageSize: 12//每页显示条数
        },
        loadingConfig: { text: '数据查询中...', effect: 'whirling', maskColor: 'transparent', textColor: '#fff' },
        rules: {
          selectdate: [{ required: true, message: '筛选时间不能为空', trigger: 'change' }],
          weekplanfinishdate: [{ required: true, message: '周计划完成时间不能为空', trigger: 'change' }]
        },
        dataList: [],
        workcenterList: [],
        pickerOptions: { shortcuts: [prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth] },
        weekShortCuts: { shortcuts: [prevWeek, thisWeek, nextWeek] },
        // 本月明细
        thisMonthChartDetail: {
          dialogVisiable: false,
          queryInfo: { seriesName: '', name: '', currentPage: 1, pageSize: 12 },
          dataList: [], title: '', total: 0
        },
        // 本周明细
        thisWeekChartDetail: {
          dialogVisiable: false,
          queryInfo: { seriesName: '', name: '', currentPage: 1, pageSize: 12 },
          dataList: [], title: '', total: 0
        },
        // 工序的时间排布
        containerPauseChartDetail: { dialogVisiable: false, queryInfo: { interval: '', currentPage: 1, pageSize: 12 }, dataList: [], title: '', total: 0 },
        // 工人未完成工时明细
        unFinishWorktimeChartDetail: { dialogVisiable: false, queryInfo: { worker: '', currentPage: 1, pageSize: 12 }, dataList: [], title: '', total: 0 },
        // 子零件批次
        childContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 子零件批次工序
        childContainerSpecDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 缺件明细
        missingPartDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 未完成子零件批次信息
        notFinishedChildContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 跳序信息
        skipStepDetail: { dialogVisiable: false, dataList: [], title: '' },
        userInfo: {},
        disabled: false
      },
      methods: {
        // 查询件号
        searchProductAsync(value, callback) {
          fetchSuggestion({ actionName: 'getGZTopProductname', name: 'productname', value, callback, triggerLength: 2 })
        },
        // 查询顶层批次号
        searchTopContainernameAsync(value, callback) {
          fetchSuggestion({ actionName: 'getGZTopContainername', name: 'containername', value, callback, triggerLength: 2 })
        },
        // 工区本月计划--柱状图
        async getThisMonthBarChart() {
          const dom = document.getElementById("thisMonthChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getThisMonthBarChart', {
            type: 'getThisMonthBarChart', ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(dom);
          chart = echarts.init(dom);

          const { pztotal, pzfinished, pzfinishrate, lstotal, lsfinished, lsfinishrate } = data[0];
          let arrXAxis = ['品种月计划', '临时月计划'],
            arrTotal = [pztotal, lstotal],
            arrFinished = [pzfinished, lsfinished],
            arrFinishRate = [pzfinishrate, lsfinishrate];

          let option = barOption();
          option.legend.data = ['总套数', '已完成', '完成率'];
          option.xAxis.data = arrXAxis;
          option.grid.left = '5%';
          option.grid.right = '5%';

          option.series[0] = _.merge(option.series[0], {
            name: '总套数',
            data: arrTotal,
            label: { color: colorList.blue.color },
            itemStyle: { color: { colorStops: colorList.blue.colorStops } }
          });

          option.series[1] = _.merge(_.cloneDeep(option.series[0]), {
            name: '已完成',
            data: arrFinished,
            label: { color: colorList.green.color },
            itemStyle: { color: { colorStops: colorList.green.colorStops } }
          });

          option.series[2] = _.merge(_.cloneDeep(option.series[0]), {
            name: '完成率',
            data: arrFinishRate,
            yAxisIndex: 1,
            label: { formatter: '{c}%', color: colorList.lightGreen.color },
            itemStyle: { color: { colorStops: colorList.lightGreen.colorStops } }
          });

          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.thisMonthChart.initWH(); chart.resize(); }, 300);

          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0 || seriesName === '完成率') { return; }
            this.thisMonthChartDetail.queryInfo.seriesName = seriesName;//系列名称
            this.thisMonthChartDetail.queryInfo.name = name;//x轴名称
            this.thisMonthChartDetail.queryInfo.currentPage = 1;
            this.thisMonthChartDetail.title = `【${this.queryInfo.workcentername}】本月【${name}】--【${seriesName}】明细`;
            this.thisMonthChartDetail.dialogVisiable = true;
            this.getThisMonthChartDetail();
          })
        },
        // 工区本周计划--柱状图
        async getThisWeekBarChart() {
          const dom = document.getElementById("thisWeekChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getThisWeekBarChart', {
            type: 'getThisWeekBarChart', ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(dom);
          chart = echarts.init(dom);

          const { pztotal, pzfinished, pzfinishrate, lstotal, lsfinished, lsfinishrate } = data[0];
          let arrXAxis = ['品种月计划', '临时月计划'],
            arrTotal = [pztotal, lstotal],
            arrFinished = [pzfinished, lsfinished],
            arrFinishRate = [pzfinishrate, lsfinishrate];

          let option = barOption();
          option.legend.data = ['总套数', '已完成', '完成率'];
          option.xAxis.data = arrXAxis;
          option.grid.left = '5%';
          option.grid.right = '5%';

          option.series[0] = _.merge(option.series[0], {
            name: '总套数',
            data: arrTotal,
            label: { color: colorList.blue.color },
            itemStyle: { color: { colorStops: colorList.blue.colorStops } }
          });

          option.series[1] = _.merge(_.cloneDeep(option.series[0]), {
            name: '已完成',
            data: arrFinished,
            label: { color: colorList.green.color },
            itemStyle: { color: { colorStops: colorList.green.colorStops } }
          });

          option.series[2] = _.merge(_.cloneDeep(option.series[0]), {
            name: '完成率',
            data: arrFinishRate,
            yAxisIndex: '1',
            label: { formatter: '{c}%', color: colorList.lightGreen.color },
            itemStyle: { color: { colorStops: colorList.lightGreen.colorStops } }
          });

          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.thisWeekChart.initWH(); chart.resize(); }, 300);
          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0 || seriesName === '完成率') { return; }
            this.thisWeekChartDetail.queryInfo.seriesName = seriesName;//系列名称
            this.thisWeekChartDetail.queryInfo.name = name;//x轴名称
            this.thisWeekChartDetail.queryInfo.currentPage = 1;
            this.thisWeekChartDetail.title = `【${this.queryInfo.workcentername}】本周【${name}】--【${seriesName}】明细`;
            this.thisWeekChartDetail.dialogVisiable = true;
            this.getThisWeekChartDetail();
          })
        },
        // 工序的时间排布【批次停滞信息】
        async getContainerPauseChart() {
          const dom = document.getElementById("containerPauseChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getContainerPauseChart', {
            type: 'getContainerPauseChart', ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(dom);
          chart = echarts.init(dom);

          const { zero_to_seven, seven_to_thirty, thirty_to_sixty, more_than_sixty } = data[0];
          let arrXAxis = ['0-7天', '7-30天', '30-60天', '60天以上'];
          let arrTotal = [zero_to_seven, seven_to_thirty, thirty_to_sixty, more_than_sixty];

          let option = barOption();
          option.legend.data = ['批次数'];
          option.xAxis.data = arrXAxis;
          option.grid.left = '5%';
          option.grid.right = '5%';

          option.series[0] = _.merge(option.series[0], {
            name: '批次数',
            data: arrTotal,
            label: { color: colorList.red.color },
            itemStyle: { color: { colorStops: colorList.red.colorStops } }
          });//lodash合并个性化配置

          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.containerPauseChart.initWH(); chart.resize(); }, 300);

          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0) { return; }
            this.containerPauseChartDetail.queryInfo.currentPage = 1;
            this.containerPauseChartDetail.queryInfo.interval = name;
            this.containerPauseChartDetail.title = `【${this.queryInfo.workcentername}】停滞【${name}】-- 批次明细`;
            this.containerPauseChartDetail.dialogVisiable = true;
            this.getContainerPauseDetail();
          })
        },
        // 工人未完成工时--柱状图
        async getUnFinishWorktimeChart() {
          const dom = document.getElementById("unFinishWorktimeChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getUnFinishWorktimeChart', {
            type: 'getUnFinishWorktimeChart', ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          // echarts.dispose(dom);
          // chart = echarts.init(dom);

          let arrWorker = [], arrWorktime = [];
          for (const item of data) {
            arrWorker.push(item.dispatchto);
            arrWorktime.push(item.durationperunit);
          }

          let option = barOption({ showDataZoom: true, startValue: 0, endValue: 14 });
          option.legend.data = ['工时'];
          option.xAxis.data = arrWorker;
          option.grid.left = '2%';
          option.grid.right = '2%';

          const { color, colorStops } = colorList.red;
          let config = { name: '工时', data: arrWorktime, label: { color }, itemStyle: { color: { colorStops } } }
          option.series[0] = _.merge(option.series[0], config);//lodash合并个性化配置

          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.unFinishWorktimeChart.initWH(); chart.resize(); }, 300);
          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0) { return; }
            this.unFinishWorktimeChartDetail.queryInfo.currentPage = 1;
            this.unFinishWorktimeChartDetail.queryInfo.worker = name;
            this.unFinishWorktimeChartDetail.title = `【${name}】未完成工时明细`;
            this.unFinishWorktimeChartDetail.dialogVisiable = true;
            this.getUnFinishWorktimeDetail();
          })
        },
        // 表格数据
        async getData() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getData', {
            type: 'getData',
            ...this.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.dataList = data;
          this.total = total;
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.datagrid.initWH(); }, 300);
        },
        // 本月明细
        async getThisMonthChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getThisMonthChartDetail', {
            type: 'getThisMonthChartDetail',
            ...this.queryInfo,
            ...this.thisMonthChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.thisMonthChartDetail.dataList = data;
          this.thisMonthChartDetail.total = total;
        },
        // 本周明细
        async getThisWeekChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getThisWeekChartDetail', {
            type: 'getThisWeekChartDetail',
            ...this.queryInfo,
            ...this.thisWeekChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.thisWeekChartDetail.dataList = data;
          this.thisWeekChartDetail.total = total;
        },
        // 工序的时间排布明细
        async getContainerPauseDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getContainerPauseDetail', {
            type: 'getContainerPauseDetail',
            ...this.queryInfo, ...this.containerPauseChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.containerPauseChartDetail.dataList = data;
          this.containerPauseChartDetail.total = total;
        },
        // 工人未完成工时
        async getUnFinishWorktimeDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getUnFinishWorktimeDetail', {
            type: 'getUnFinishWorktimeDetail',
            ...this.queryInfo, ...this.unFinishWorktimeChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.unFinishWorktimeChartDetail.dataList = data;
          this.unFinishWorktimeChartDetail.total = total;
        },
        // 子零件批次
        async showChildContainer(row) {
          const { containerid, containername } = row;
          this.childContainerDetail.title = `【${containername}】明细`;
          this.childContainerDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getChildContainer', {
            type: 'getChildContainer',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.childContainerDetail.dataList = data;
        },
        // 查看子零件批次各工序
        async showChildContainerSpec(row) {
          const { containerid, containername } = row;
          this.childContainerSpecDetail.title = `【${containername}】各工序派报检明细`;
          this.childContainerSpecDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getChildContainerSpec', {
            type: 'getChildContainerSpec',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.childContainerSpecDetail.dataList = data;
        },
        // 查询缺件
        async getMissingPart(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.missingPartDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getMissingPart', {
            type: 'getMissingPart',
            containername
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.missingPartDetail.title = `【${containername}】缺件明细`;
          this.missingPartDetail.dataList = data;
        },
        // 未完成子零件
        async getNotFinishedChildContainer(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.notFinishedChildContainerDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getNotFinishedChildContainer', {
            type: 'getNotFinishedChildContainer',
            containername
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.notFinishedChildContainerDetail.title = `【${containername}】未完成子零件批次信息`;
          this.notFinishedChildContainerDetail.dataList = data;
        },
        // 查询跳序信息(根据顶层图号批次)
        async getSkipStepInfo(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.skipStepDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getSkipStepInfo', {
            type: 'getSkipStepInfo', containername, factoryname: this.queryInfo.factoryname
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.skipStepDetail.title = `【${containername}】未完工工序信息`;
          this.skipStepDetail.dataList = data;
        },
        // 查询跳序信息(根据子批次号)
        async getChildContainerSkipInfo(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.skipStepDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=getChildContainerSkipInfo', {
            type: 'getChildContainerSkipInfo', containername, factoryname: this.queryInfo.factoryname
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.skipStepDetail.title = `【${containername}】未完工工序信息`;
          this.skipStepDetail.dataList = data;
        },
        // 查询按钮点击
        searchData() {
          this.$refs['queryInfoRef'].validate(async (valid) => {
            if (!valid) { return this.$message.error('必填项不能为空'); }
            this.getThisMonthBarChart();
            this.getThisWeekBarChart();
            this.getContainerPauseChart();
            this.getUnFinishWorktimeChart();
            this.getData();
          })
        },
        handleCurrentChange(newPage) {
          this.queryInfo.currentPage = newPage;
          this.getData();
        },
        handleSizeChange(pageSize) {
          this.queryInfo.pageSize = pageSize;
          this.getData();
        },
        workcenterSelectChange(val) {
          this.queryInfo.workcentername = this.workcenterList.filter(i => i.workcenterid === val)[0].workcentername;
          document.title = `${this.queryInfo.workcentername}看板v2.0`;
        },
        // 导出
        exportDetail() {
          const config = {
            url: '../handler/board/GZWorkcenterTaskDashBoardV3.ashx?action=exportExcel',
            data: { type: 'exportExcel', ...this.queryInfo }
          }
          exportExcelData(config, this);
        },
        async open(pageurl, reportname) {
          this.$confirm(`即将跳转并打开【${reportname}】`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            const { origin, search } = window.location;
            let url = `${origin}/MESReport/Baobiao/${pageurl}${search}`;
            window.open(url);
          }).catch(() => {
            this.$message.info('取消跳转');
          });
        },
        handleThisMonthChartDetailCurrentChange(newPage) {
          this.thisMonthChartDetail.queryInfo.currentPage = newPage;
          this.getThisMonthChartDetail();
        },
        handleThisWeekChartDetailCurrentChange(newPage) {
          this.thisWeekChartDetail.queryInfo.currentPage = newPage;
          this.getThisWeekChartDetail();
        },
        handleContainerPauseChartDetailCurrentChange(newPage) {
          this.containerPauseChartDetail.queryInfo.currentPage = newPage;
          this.getContainerPauseDetail();
        },
        handleUnFinishWorktimeChartDetailCurrentChange(newPage) {
          this.unFinishWorktimeChartDetail.queryInfo.currentPage = newPage;
          this.getUnFinishWorktimeDetail();
        }
      },
      async mounted() {
        let incrementNumber = () => {
          setTimeout(incrementNumber, 500);
          this.currentTime = dayjs().format('YYYY年MM月DD日  HH:mm:ss');
        }
        setTimeout(incrementNumber, 500);
        const startOfThisMonth = dayjs().startOf('month').format('YYYY-MM-DD');
        const endOfThisMonth = dayjs().endOf('month').format('YYYY-MM-DD');
        const startOfThisWeek = dayjs().startOf('week').format('YYYY-MM-DD');
        const endOfThisWeek = dayjs().endOf('week').format('YYYY-MM-DD');
        this.queryInfo.selectdate = [startOfThisMonth, endOfThisMonth];
        this.queryInfo.thisweek = [startOfThisWeek, endOfThisWeek];
        this.queryInfo.weekplanfinishdate = [startOfThisWeek, endOfThisWeek];
        this.userInfo = await getUserInfo({ employeeid: getParams("uid") });
        const factoryInfo = await getFactoryInfo({ factoryid: Decrypt(getParams('factoryid')), isMapping: '是' });//查询当前分厂信息
        const { factoryid, factoryname } = factoryInfo[0];
        this.queryInfo.factoryname = factoryname;
        this.queryInfo.factoryid = factoryid;

        this.workcenterList = await getWorkcenterList({ factoryname: this.queryInfo.factoryname, workcentertype: '工区' });
        if (this.workcenterList.some(item => item.workcentername === this.userInfo.workcentername)) {
          this.queryInfo.workcentername = this.userInfo.workcentername;
          this.queryInfo.workcenterid = this.userInfo.workcenterid;
        } else {
          this.queryInfo.workcentername = this.workcenterList[0].workcentername;
          this.queryInfo.workcenterid = this.workcenterList[0].workcenterid;
        }
        document.title = `${this.queryInfo.workcentername}看板v3.0`;

        this.getThisMonthBarChart();
        this.getThisWeekBarChart();
        this.getContainerPauseChart();
        this.getUnFinishWorktimeChart();
        this.getData();
      },
      computed: {
        worktimeratelable() { return `${this.queryInfo.worktimerate[0]}% ~ ${this.queryInfo.worktimerate[1]}%`; }
      }
    })
  </script>
</body>

</html>